<template>
  <div class="flex">
    <iframe id="mapPage" width="100%" height="100%" frameborder="0" :src="`https://apis.map.qq.com/tools/locpicker?key=${key}&referer=dstc&search=1&type=1`"></iframe>
  </div>
</template>

<script>
export default {
  data (){
    return {
      key: '3KABZ-XANRS-632OU-6J3UC-YMXJK-SSBFS',
    }
  },

  mounted (){
    window.addEventListener('message', ({data: loc}) =>{
      if (loc && loc.module == 'locationPicker'){
        this.$route.params.callback(loc.poiaddress, {
          lat: loc.latlng.lat,
          lon: loc.latlng.lng
        })
      }
    })
  },
}
</script>

<style lang="less" scoped>

</style>